#!/bin/bash

echo "启动涂色抢地盘游戏开发环境..."

echo "1. 启动缓存服务..."
docker-compose up -d redis

echo "2. 等待缓存服务启动..."
sleep 5

echo "3. 启动后端API服务..."
cd backend
gnome-terminal -- bash -c "dotnet run --project src/TerritoryGame.API; exec bash" &

echo "4. 等待后端启动..."
sleep 5

echo "5. 启动前端开发服务器..."
cd ../frontend
gnome-terminal -- bash -c "npm run dev; exec bash" &

echo "开发环境启动完成！"
echo "前端地址: http://localhost:3000"
echo "后端API: http://localhost:5000"
echo "Swagger文档: http://localhost:5000/swagger"

echo "按任意键退出..."
read -n 1
